function get_commit_list(){
local i=0
for id in `cat commit_list`
do
commit_id[$i]=$id
let i+=1
done

local len=${#commit_id[*]}
let len-=1
local j=0
for ind in `seq $len -1 0`
do
commit_ids[$j]=${commit_id[$ind]}
let j=j+1
done
echo ${commit_ids[*]}
}

function main() {
commit_ids=($(get_commit_list))
for commit_id in ${commit_ids[*]}
do
  echo -e "\033[34m start processing $commit_id \033[0m"
  echo "it's commit id: $commit_id"
  git cherry-pick -s $commit_id
  if [[ $? -ne 0 ]];then
        exit 0
  fi
done
}
main
